********************************************************************************
* Purpose: Imams data analysis - scaleup Eid ul Azha 2020 
* Sub-file: test for treatment affecting response to MS call
********************************************************************************

	****************************************************************************
	* Load data
	****************************************************************************

	use			"${imamsurvey}/merged_scaleup.dta" , clear 

	keep		if MS_call_status < .											// Keep only respondents for whom we attempted an MS call 
																				
	label		variable control "Control group (assigned to baseline survey)" 
	
	
	****************************************************************************
	* Estimates
	****************************************************************************
		
	estimates	clear

	foreach		i of varlist respond_ms   {
					
				reg 		`i' treatment_combined treatment_secular ///
									if consent_statement==1, robust 			// Because of the MS sampling strategy, we restrict the sample here to people who responded in the baseline / T calls
												
				est 		sto estbasic`i'
				
				test 		treatment_combined = treatment_secular
				estadd 		scalar pval = round(r(p), .01)

				test		treatment_combined = treatment_secular = 0 
				estadd 		scalar pvaljoint = round(r(p), .01)				
				
				estadd		local sample "Sample 1"
				
				
				reg 		`i' control ///
								if inlist(treatment_scaleup, 3, 4), robust 		// Compare control vs. super-control 
	
				estadd		local sample "Sample 2"
	
				est 		sto estsc`i'
								
	}


	****************************************************************************
	* Table
	****************************************************************************
	

	esttab		estbasicrespond_ms estscrespond_ms using "${texrct}/scaleup_response_simple.tex" , ///
					replace star(* .1 ** .05 *** .01) se  t(3) b(3) label ///
					scalars("pval P-value, treatment effects equal" ///
					"pvaljoint P-value, all treatments = 0" /// 
					"sample Sample") ///
					nonotes booktabs fragment
					
				